package com.nowcoder.community.config;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import java.io.File;

/**
 * @author szq
 * @create 2023-03-24 14:01
 * @description
 */
@Configuration
@Slf4j
public class WkConfig implements InitializingBean {

    @Value("${wk.image.storage}")
    private String wkImageStorage;

    @Override
    public void afterPropertiesSet() throws Exception {
        // 创建WK图片目录
        File file = new File(wkImageStorage);
        if (!file.exists()) {
            file.mkdirs();
            log.info("创建WK图片目录：" + wkImageStorage);
        }
    }
}
